package com.sam.gui.activity;

import android.content.Intent;
import android.os.Bundle;
import android.webkit.JavascriptInterface;

import com.sam.gui.base.BaseWebActivity;
import com.sam.ui.base.activity.BaseActivity;

public class MakeAppointmentWebActivity extends BaseWebActivity {

    @Override
    protected void initView() {
        super.initView();
        setContentUrl("index.php?c=user&a=user_new_yy");
    }

    @JavascriptInterface
    public void wzjlxq(){
        Intent intent = new Intent(this, DiagnosisRecordWebActivity.class);
        startActivity(intent);
    }

    @JavascriptInterface
    public void myinfo_by_ys(){   //我的医生列表
        Intent intent = new Intent(this, MyDoctorListSpinnerWebActivity.class);
        Bundle bundle = new Bundle();
        bundle.putString("is_not_edit", "yes");
        intent.putExtras(bundle);
        startActivityForResult(intent, 999);
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        switch (resultCode) { //resultCode为回传的标记，我在B中回传的是RESULT_OK
            case 999:   //设置医生姓名
                String ys_name = data.getStringExtra("ys_name");
                webView.loadUrl("javascript:set_ysname('"+ys_name+"')");
                break;
            default:
                break;
        }
        super.onActivityResult(requestCode, resultCode, data);
    }
    @JavascriptInterface
    public void ys_view(String pid){
        Intent intent = new Intent(this, DoctorDetailsWebActivity.class);
        Bundle bundle = new Bundle();
        bundle.putString("pid", pid);
        intent.putExtras(bundle);
        startActivity(intent);
    }

    @JavascriptInterface
    public void send_ys(String pid){
        Intent intent = new Intent(this, MakeAnAppointmentWebActivity.class);
        Bundle bundle = new Bundle();
        bundle.putString("pid", pid);
        intent.putExtras(bundle);
        startActivity(intent);
        finish();
    }

    @JavascriptInterface
    public void send_ys_by_sjb(String id){
        Intent intent = new Intent(this, MakeAppointmentToDoctorWebActivity.class);
        Bundle bundle = new Bundle();
        bundle.putString("id", id);
        intent.putExtras(bundle);
        startActivity(intent);
        finish();
    }

    @JavascriptInterface
    public void submitSuccess(){
        finish();
    }
}
